﻿using System;
using System.Collections.Generic;
using System.Text;

namespace class3Homework
{
    class triangle:geometry
    {
        private double side1;
        private double side2;
        private double side3;
        public override double Area
        {
            get
            {
                return getArea(side1, side2, side3);
            }
        }
        public double Side1
        {
            get
            {
                return side1;
            }
            set
            {
                side1 = value;
            }
        }
        public double Side2
        {
            get
            {
                return side2;
            }
            set
            {
                side2 = value;
            }
        }
        public double Side3
        {
            get
            {
                return side3;
            }
            set
            {
                side3 = value;
            }
        }
        public triangle(double side1,double side2,double side3):base("triangle")
        {
            this.side1 = side1;
            this.side2 = side2;
            this.side3 = side3;
        }
        public override bool selfCheck()
        {
            if((side1+side2)>side3&&(side1+side3)>side2&&(side2+side3)>side1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        public double getArea(double a,double b,double c)
        {
            double p = (a + b + c) / 2;
            return Math.Sqrt(p * (p - a) * (p - b) * (p - c));
        }
    }
}
